import './StudentTestListPage.scss'
import TestItem from './componets/TestItem/TestItem';
import { fetchGetTestList } from '@/store/modules/student';
import { useDispatch,useSelector } from 'react-redux';
import { useEffect } from 'react';


function StudentTestPage(){
    const dispatch = useDispatch();
    const { user_status } = useSelector(state => state.user);
    const { testList } = useSelector(state => state.student);

    useEffect(()=>{
        async function getTestList(){
            dispatch(fetchGetTestList(user_status.class_id,user_status.token));
        }

        getTestList();
    },[])

    return (
        <div className="StudentTestPage">
            {testList.map((ele,index)=><TestItem key={index} Info={ele} />)}
        </div>
    )
}

export default StudentTestPage;